import Cookies from 'js-cookie'

const TokenKey = 'quemingToken'

const UserKey='CurrentUser'
// 普通形式export function getToken(){
//     return Cookie.get(TokenKey)
// }
export const getToken=()=>{
    return Cookies.get(TokenKey)
}


export const setToken=token=>{
    return Cookies.set(TokenKey,token)
}

export const removeToken=()=>{
     Cookies.remove(TokenKey)
}


export const getCurrentUser=()=>{
    const user=Cookies.get(UserKey)
    return user===undefined?null: JSON.parse(user)
}


export const setCurrentUser=currentUser=>{

    return Cookies.set(UserKey,JSON.stringify(currentUser))
}

export const removeCurrentUser=()=>{
    Cookies.remove(UserKey)
}
